package com.hhf.feiojcodesandbox.factory;



import com.hhf.feiojcodesandbox.service.CodeSandbox;
import com.hhf.feiojcodesandbox.service.impl.ExampleCodeSandbox;
import com.hhf.feiojcodesandbox.proxy.CodeSandboxDynamicProxy;

import java.lang.reflect.Proxy;

/**
 * @Author hhf
 * @Date 2024/10/27
 * @Description
 */
public class CodeSandboxProxyFactory {


    public static CodeSandbox getInstance() {

        ExampleCodeSandbox codeSandbox = new ExampleCodeSandbox();


        CodeSandbox proxy = (CodeSandbox) Proxy.newProxyInstance(
                CodeSandbox.class.getClassLoader(),
                new Class[]{CodeSandbox.class},
                new CodeSandboxDynamicProxy(codeSandbox));

        return proxy;
    }


}
